<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">

<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>BMS</title>
<meta name="description" content="" />
<meta name="keywords" content="index" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="renderer" content="webkit" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<meta name="apple-mobile-web-app-title" content="Amaze UI" />
<link rel="icon" type="image/png" th:href="@{/ui/i/favicon.png}" />
<link rel="apple-touch-icon-precomposed" th:href="@{/ui/i/app-icon72x72@2x.png}" />
<link th:href="@{/bootstrap/bootstrap.min.css}" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" th:href="@{/ui/css/amazeui.min.css}" />
<link rel="stylesheet" th:href="@{/ui/css/app.css}" />
<link rel="stylesheet" th:href="@{/ui/css/layui.css}" />
<link th:href="@{/plugins/bootstrap-fileinput/css/fileinput.min.css}" rel="stylesheet" type="text/css"/>
<link th:href="@{/plugins/dtGrid/dlshouwen.grid.min.css}" rel="stylesheet" type="text/css"/>
<script th:src="@{/ui/js/jquery.min.js}"></script>
 <script type="text/javascript" th:src="@{/plugins/ckeditor/ckeditor.js}"></script>	
 <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&amp;ak=MV7xV6YoqveuuGRyk9wTl3xlj12mfDpV"></script>
 <script type="text/javascript" src="http://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.js"></script> 
<link rel="stylesheet" href="http://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.css" />
</head>

<body data-type="index">
	<script th:src="@{/ui/js/theme.js}"></script>
	<div class="am-g tpl-g">
		<!-- 头部 -->
		<header>
			<!-- logo -->
			<div class="am-fl tpl-header-logo">
				<a href="javascript:;"><img th:src="@{/ui/img/logo.png}" alt="" /></a>
			</div>
			<!-- 右侧内容 -->
			<div class="tpl-header-fluid">
				<!-- 侧边切换 -->
				<div class="am-fl tpl-header-switch-button am-icon-list">
					<span> </span>
				</div>
				<!-- 搜索 -->
				<div class="am-fl tpl-header-search">
					<form class="tpl-header-search-form" action="javascript:;">
						<button class="tpl-header-search-btn am-icon-search"></button>
						<input class="tpl-header-search-box" type="text"
							placeholder="搜索内容..." />
					</form>
				</div>
				<!-- 其它功能-->
				<div class="am-fr tpl-header-navbar">
					<ul>
						<!-- 欢迎语 -->
						<li class="am-text-sm tpl-header-navbar-welcome"><a
							href="javascript:;">欢迎你, <span  th:text="${user.userName}"></span>
						</a></li>

						<!-- 新邮件 -->
						<li class="am-dropdown tpl-dropdown" data-am-dropdown="{justify: '.am-dropdown'}"><a href="javascript:;" class="am-dropdown-toggle tpl-dropdown-toggle"> <i class="am-icon-envelope"></i> 
						<span class="am-badge am-badge-success am-round item-feed-badge">4</span>
						</a> <!-- 弹出列表 -->
							<ul class="am-dropdown-content tpl-dropdown-content">
								<li class="tpl-dropdown-menu-messages"><a href="javascript:;" class="tpl-dropdown-menu-messages-item am-cf">
										<div class="menu-messages-ico">
											<img th:src="@{/ui/img/user04.png}" alt="" />
										</div>
										<div class="menu-messages-time">3小时前</div>
										<div class="menu-messages-content">
											<div class="menu-messages-content-title">
												<i class="am-icon-circle-o am-text-success"></i> <span>夕风色</span>
											</div>
											<div class="am-text-truncate">Amaze UI 的诞生，依托于 GitHub
												及其他技术社区上一些优秀的资源；Amaze UI 的成长，则离不开用户的支持。</div>
											<div class="menu-messages-content-time">2016-09-21 下午
												16:40</div>
										</div>
								</a></li>

								<li class="tpl-dropdown-menu-messages"><a
									href="javascript:;"
									class="tpl-dropdown-menu-messages-item am-cf">
										<div class="menu-messages-ico">
											<img th:src="@{/ui/img/user02.png}" alt="" />
										</div>
										<div class="menu-messages-time">5天前</div>
										<div class="menu-messages-content">
											<div class="menu-messages-content-title">
												<i class="am-icon-circle-o am-text-warning"></i> <span>禁言小张</span>
											</div>
											<div class="am-text-truncate">为了能最准确的传达所描述的问题，
												建议你在反馈时附上演示，方便我们理解。</div>
											<div class="menu-messages-content-time">2016-09-16 上午
												09:23</div>
										</div>
								</a></li>
								<li class="tpl-dropdown-menu-messages"><a href="javascript:;"
									class="tpl-dropdown-menu-messages-item am-cf"> <i
										class="am-icon-circle-o"></i> 进入列表…
								</a></li>
							</ul></li>

						<!-- 新提示 -->
						<li class="am-dropdown" data-am-dropdown="{justify: '.am-dropdown'}"><a href="javascript:;"
							class="am-dropdown-toggle"> <i class="am-icon-bell"></i> <span
								class="am-badge am-badge-warning am-round item-feed-badge">5</span>
						</a> <!-- 弹出列表 -->
							<ul id="advice" class="am-dropdown-content tpl-dropdown-content">
								<li class="tpl-dropdown-menu-notifications"><a
									href="javascript:;"
									class="tpl-dropdown-menu-notifications-item am-cf">
										<div class="tpl-dropdown-menu-notifications-title">
											<i class="am-icon-line-chart"></i> <span> 有6笔新的销售订单</span>
										</div>
										<div class="tpl-dropdown-menu-notifications-time">12分钟前
										</div>
								</a></li>
								<li class="tpl-dropdown-menu-notifications"><a
									href="javascript:;"
									class="tpl-dropdown-menu-notifications-item am-cf">
										<div class="tpl-dropdown-menu-notifications-title">
											<i class="am-icon-star"></i> <span> 有3个来自人事部的消息</span>
										</div>
										<div class="tpl-dropdown-menu-notifications-time">30分钟前
										</div>
								</a></li>
								<li class="tpl-dropdown-menu-notifications"><a
									href="javascript:;"
									class="tpl-dropdown-menu-notifications-item am-cf">
										<div class="tpl-dropdown-menu-notifications-title">
											<i class="am-icon-folder-o"></i> <span> 上午开会记录存档</span>
										</div>
										<div class="tpl-dropdown-menu-notifications-time">1天前</div>
								</a></li>


								<li class="tpl-dropdown-menu-notifications"><a
									href="javascript:;"
									class="tpl-dropdown-menu-notifications-item am-cf"> <i
										class="am-icon-bell"></i> 进入列表…
								</a></li>
							</ul></li>

						<!-- 退出 -->
						<li class="am-text-sm"><a href="/logout"> <span
								class="am-icon-sign-out"></span> 退出
						</a></li>
					</ul>
				</div>
			</div>

		</header>
		<!-- 风格切换 -->
		<div class="tpl-skiner">
			<div class="tpl-skiner-toggle am-icon-cog"></div>
			<div class="tpl-skiner-content">
				<div class="tpl-skiner-content-title">选择主题</div>
				<div class="tpl-skiner-content-bar">
					<span class="skiner-color skiner-white" data-color="theme-white"></span>
					<span class="skiner-color skiner-black" data-color="theme-black"></span>
				</div>
			</div>
		</div>
		<!-- 侧边导航栏 -->
		<div class="left-sidebar">
			<!-- 用户信息 -->
			<div class="tpl-sidebar-user-panel">
				<div class="tpl-user-panel-slide-toggleable">
					<div class="tpl-user-panel-profile-picture">
						<img th:src="${user.img}"  alt="" />
					</div>
					<span class="user-panel-logged-in-text" th:text="${user.userName}"> <i
						class="am-icon-circle-o am-text-success tpl-user-panel-status-icon"></i>
					</span> <a href="javascript:;" class="tpl-user-panel-action-link" th:onclick="'loadPage(\'/user/'+${user.id}+'/info\')'" > <span
						class="am-icon-pencil"></span> 账号设置
					</a>
				</div>
			</div> 


		<ul class="sidebar-nav">
				<li class="sidebar-nav-link"><a href="index.html" class="active" > <i class="am-icon-home sidebar-nav-link-logo"></i>首页</a></li>
				<li class="sidebar-nav-link" th:each="menu:${menus}" >
					<a href="javascript:;" class="sidebar-nav-sub-title" > <i class="sidebar-nav-link-logo" th:attrappend="class=' '+${menu.icon}"></i><nb th:text="${menu.name}"></nb>
						<span class="am-icon-chevron-down am-fr am-margin-right-sm sidebar-nav-sub-ico" th:if="${#lists.size(menu.children)>0}"></span>
					</a>
					<ul class="sidebar-nav sidebar-nav-sub" th:if="${#lists.size(menu.children)>0}">
						<li class="sidebar-nav-link" th:each="child:${menu.children}"><a th:onclick="'menuLoad(\''+${child.sourceUrl}+'\',this)'"> <span class="am-icon-angle-right sidebar-nav-link-logo"></span> <nb th:text="${child.name}"></nb></a></li>
					</ul>
				</li>
			</ul>
		</div>

	


		<!-- 内容区域 -->
		<div  id="" class="tpl-content-wrapper">
<!--<div>
    <div>
        <button id="connect" onclick="connect();">连接</button>
        <button id="disconnect" disabled="disabled" onclick="disconnect();">断开连接</button>
    </div>
    <div id="conversationDiv">
        <label>输入你的名字</label><input type="text" id="name" />
        <button id="sendName" onclick="sendName();">发送</button>
         <div class="site-demo-button" id="layerDemo" style="margin-bottom: 0;">

  <button  data-method="setTop" class="layui-btn">多窗口模式，层叠置顶</button>
</div>
        <p id="response"></p>
    </div>
</div>-->

</div>
	</div>
	<script th:src="@{/ui/js/amazeui.min.js}"></script>
<!-- 	<script th:src="@{/plugins/dtGrid/dlshouwen.grid.js}"></script> -->
	<script th:src="@{/plugins/dtGrid/dlshouwen.grid.treegrid.js}"></script>
	<script th:src="@{/plugins/dtGrid/i18n/zh-cn.js}"></script>
	<script th:src="@{/plugins/layer-v2.3/layer.js}"></script>	
	<script type="text/javascript" th:src="@{/plugins/jquery-validation/jquery.validate.min.js}"></script>
	<script type="text/javascript" th:src="@{/plugins/jquery-validation/localization/messages_zh.js}"></script>
	<script type="text/javascript" th:src="@{/plugins/bootstrap-fileinput/js/fileinput.js}"></script>
	<script th:src="@{/ui/js/app.js}"></script>
	<script th:src="@{/ui/js/sockjs.min.js}"></script>
	<script th:src="@{/ui/js/stomp.min.js}"></script>
	<script th:src="@{/ui/js/layui.all.js}"></script>
	
	<script th:inline="javascript"> var contextRoot = /*[[@{/}]]*/ ''; </script>
</body>
<script>
  layui.use('layer', function(){ //独立版的layer无需执行这一句
  var $ = layui.jquery, layer = layui.layer; //独立版的layer无需执行这一句
  
  //触发事件
  var active = {
    setTop: function(){
      var that = this; 
      //多窗口模式，层叠置顶
      layer.open({
        type: 2 //此处以iframe举例
        ,title: '当你选择该窗体时，即会在最顶端'
        ,area: ['390px', '260px']
        ,shade: 0
        ,maxmin: true
        ,offset: [ //为了演示，随机坐标
          Math.random()*($(window).height()-300)
          ,Math.random()*($(window).width()-390)
        ] 
        ,content: 'template403.html'
        ,btn: ['继续弹出', '全部关闭'] //只是为了演示
        ,yes: function(){
          $(that).click(); 
        }
        ,btn2: function(){
          layer.closeAll();
        }
        
        ,zIndex: layer.zIndex //重点1
        ,success: function(layero){
          layer.setTop(layero); //重点2
        }
      });
    }
    
  };
  
  $('.layui-btn').on('click', function(){
    var othis = $(this), method = othis.data('method');
    active[method] ? active[method].call(this, othis) : '';
  });
  
});
</script>
<script th:inline="javascript">
var stompClient = null;


$(function(){
	alert(11)
	connect();
})


function setConnected(connected) {
    document.getElementById('connect').disabled = connected;
    document.getElementById('disconnect').disabled = !connected;
    document.getElementById('conversationDiv').style.visibility = connected ? 'visible' : 'hidden';
    $('#response').html();
}

function connect() {
	/*<![CDATA[*/
	var userid = [[${user.userName}]];  
	/*]]>*/
    var socket = new SockJS('/ricky-websocket'); //1
    stompClient = Stomp.over(socket);//2
    stompClient.connect({login:userid}, function(frame) {//3
        setConnected(true);
        console.log('开始进行连接Connected: ' + frame);

        stompClient.subscribe('/ricky/topic/greetings', function(respnose){ //4
        	console.log("kk"+ JSON.stringify(respnose))
            showResponse(JSON.parse(respnose.body).content);
        });
    });
}


function disconnect() {
    if (stompClient != null) {
        stompClient.disconnect();
    }
    setConnected(false);
    console.log("Disconnected");
}

function sendName() {
    var name = $('#name').val();
    stompClient.send("/app/msg/hellosingle", {}, JSON.stringify({'name': $("#name").val(),'id':/*<![CDATA[*/[[${user.userName}]]/*]]>*/}));//5
}

function showResponse(message) {
      var response = $("#advice");
       response.append('<li class="tpl-dropdown-menu-notifications">'+
     '<a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">'+
					  '<div class="tpl-dropdown-menu-notifications-title"><i class="am-icon-star"></i> <span>'+message+'</span></div>'+
					  '<div class="tpl-dropdown-menu-notifications-time">1天前</div>'+
	 '</a></li>');
}


    </script>


    <script type="text/javascript">
        /*<![CDATA[*/
        //创建地图
        var map = new BMap.Map("container");          // 创建地图实例
        var point = new BMap.Point(114.064, 22.531);  // 创建点坐标
        map.centerAndZoom(point, 13);    
        map.addControl(new BMap.MapTypeControl()); 
        map.setCurrentCity("深圳");  
    	map.enableScrollWheelZoom(true);     //开启鼠标滚轮缩放// 初始化地图，设置中心点坐标和地图级别
    	function showInfo(e){
    		console.log(e.point.lng + ", " + e.point.lat);
    	}
    	map.addEventListener("click", showInfo);
    	//添加点函数
	  	function addMarker(point,label){
    		console.log(point);
    		console.log(label)
			var marker = new BMap.Marker(point);
			map.addOverlay(marker);
			marker.setLabel(label);
		}
    	//地图加载完成
    	var resource=null;
    	map.addEventListener("tilesloaded",function(){
    		if(!resource){
    		$.post("product/all",{},function(re){
    		    console.log(JSON.stringify(re))
    		    resource=re;
    		    if(re.status==0){
    		        $.each(re.data, function(o, obj) {
    		        	var point = new BMap.Point(obj.lng,obj.lat);
    		        	console.log(point)
    		        	var label = new BMap.Label(obj.title+obj.descs);
    		        	addMarker(point,label);
    		        	
        		    });
    		    }else{
    		    	//设备加载失败
    		    }
    		  });
    			
    		}
    		
    		
    	});
    	
    	
    	
    	//当前地图查询
    	var local = new BMap.LocalSearch(map, {
    		renderOptions:{map: map}
    	});
    	
    	$('#search_input').bind('keyup', function(event) {
    		if (event.keyCode == "13") {
    			//回车执行查询
    			local.search($('#search_for_map').val());
    			
    		}
    	});
    	
    	$('.tpl-header-search-btn').bind('click', function(event) {    
    			//点击执行查询
    			local.search($('#search_for_map').val());
    	});
    	
    	
    	
        /*]]>*/
        

        

    	// 百度地图API功能


        
    </script>
</html>